import FViewModule from "../../Libs/Framework/Support/FViewModule";

const { ccclass, property } = cc._decorator;
@ccclass
export default class GameToggle extends FViewModule {

    private text: cc.Label;

    /**设置文字和相应的group */
    public setTextAndGroup(txt: string, group: cc.ToggleGroup) {
        this.text = this.getComponentInChildren(cc.Label);
        this.text.string = txt;
        this.node.on('toggle', this.onToggleClick, this);
        this.getComponent(cc.Toggle).toggleGroup = group;
    }

    private onToggleClick(evt: cc.Event.EventCustom) {
        this.text.node.color = cc.Color.WHITE;
    }
}
